package com.um.swing.ui;

import com.um.swing.common.inc.Constant;

import javax.swing.*;
import javax.swing.border.BevelBorder;
import javax.swing.plaf.basic.BasicToolBarUI;
import java.awt.*;


/**
 * tool bar UI for PView
 */
public class IToolBarUI extends BasicToolBarUI {

    public static final int TOOL_BAR_HEIGHT = 40;

    public IToolBarUI() {
    }

    @Override
    public void installUI(JComponent c) {
        super.installUI(c);
        c.setPreferredSize(new Dimension(c.getWidth(), TOOL_BAR_HEIGHT));
        c.setBorder(new BevelBorder(2, Constant.MAIN_BG_COLOR, Constant.MAIN_BG_COLOR));
        c.setLayout(new FlowLayout(15, 5, SwingConstants.LEFT));
    }


    @Override
    public void paint(Graphics g, JComponent comp) {
        Graphics2D g2 = (Graphics2D) g;
        g2.setColor(Constant.MAIN_BG_COLOR);
        g2.fill3DRect(0, 0, comp.getWidth(), comp.getHeight(), true);
    }
}
